﻿<!DOCTYPE html>
<html ng-app="demoApp" lang="en">
<head>
    <title id='Description'>AngularJS Chart Scatter Series Example</title>
   <meta name="description" content="This is an example of AngularJS Chart. Chart Scatter Series." />	
    <link rel="stylesheet" type="text/css" href="../../../jqwidgets/styles/jqx.base.css" />
    <script type="text/javascript" src="../../../scripts/angular.min.js"></script> <script type="text/javascript" src="../../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxdraw.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxchart.core.js"></script><script type="text/javascript" src="../../../jqwidgets/jqxangular.js"></script>
    <script type="text/javascript" src="../../../scripts/demos.js"></script>
    <script type="text/javascript">
        var demoApp = angular.module("demoApp", ["jqwidgets"]);
        demoApp.controller("demoController", function ($scope) {
            // chart's instance.
            $scope.chart = {};

            // prepare chart data as an array
            var sampleData = [
                    { City: 'New York', SalesQ1: 330500, SalesQ2: 210500, YoYGrowth: 1.05 },
                    { City: 'London', SalesQ1: 120000, SalesQ2: 169000, YoYGrowth: 1.15 },
                    { City: 'Paris', SalesQ1: 205000, SalesQ2: 275500, YoYGrowth: 1.45 },
                    { City: 'Tokyo', SalesQ1: 187000, SalesQ2: 130100, YoYGrowth: 0.45 },
                    { City: 'Berlin', SalesQ1: 187000, SalesQ2: 113000, YoYGrowth: 1.65 },
                    { City: 'San Francisco', SalesQ1: 142000, SalesQ2: 102000, YoYGrowth: 1.25 },
                    { City: 'Chicago', SalesQ1: 171000, SalesQ2: 124000, YoYGrowth: 0.75 }
                ];

            // prepare jqxChart settings
            $scope.settings = {
                title: "Sales by City in Q1 & Q2",
                description: "",
                created: function(args)
                {
                    $scope.chart = args.instance;
                },
                enableAnimations: true,
                showLegend: true,
                padding: { left: 5, top: 5, right: 5, bottom: 5 },
                titlePadding: { left: 90, top: 0, right: 0, bottom: 10 },
                source: sampleData,
                xAxis:
                    {
                        dataField: 'City',
                        valuesOnTicks: false
                    },
                colorScheme: 'scheme01',
                seriesGroups:
                    [
                        {
                            type: 'scatter',
                            valueAxis:
                            {
                                unitInterval: 50000,
                                minValue: 50000,
                                maxValue: 350000,
                                description: 'Sales ($)',
                                formatSettings: { prefix: '$', thousandsSeparator: ',' }
                            },
                            series: [
                                    { dataField: 'SalesQ1', symbolSize: 20, symbolType: 'circle', displayText: 'Sales in Q1'},
                                    { dataField: 'SalesQ2', symbolSize: 20, symbolType: 'diamond', displayText: 'Sales in Q2'}
                                ]
                        }
                    ]
            };

            // symbol selection drop down
            var symbolsList = ["circle", "diamond", "square", "triangle_up", "triangle_down", "triangle_left", "triangle_right"];
            $scope.dropDownSerie1SymbolSettings = { source: symbolsList, selectedIndex: 2, width: '200', height: '25', dropDownHeight: 100 };

            $scope.dropDownSerie1SymbolChange = function (event) {
                var value = event.args.item.value;
                $scope.chart.seriesGroups[0].series[0].symbolType = value;
                $scope.chart.update();
            };

            $scope.dropDownSerie2SymbolSettings = { source: symbolsList, selectedIndex: 1, width: '200', height: '25', dropDownHeight: 100 };

            $scope.dropDownSerie2SymbolChange = function (event) {
                var value = event.args.item.value;
                $scope.chart.seriesGroups[0].series[1].symbolType = value;
                $scope.chart.update();
            }
        });
    </script>
</head>
<body ng-controller="demoController" class='default'>
    <jqx-chart jqx-settings="settings" style="width: 850px; height: 500px">
    </jqx-chart>
    <table style="width: 550px">
        <tr>
            <td>
                <p style="font-family: Verdana; font-size: 12px;">Select Serie 1 Symbol:
                </p>
                <jqx-drop-down-list jqx-settings='dropDownSerie1SymbolSettings' jqx-on-change="dropDownSerie1SymbolChange(event)">
                </jqx-drop-down-list>
            </td>
            <td>
                <p style="font-family: Verdana; font-size: 12px;">Select Serie 2 Symbol:
                </p>
                <jqx-drop-down-list jqx-settings='dropDownSerie2SymbolSettings' jqx-on-change="dropDownSerie2SymbolChange(event)">
                </jqx-drop-down-list>
            </td>
        </tr>
    </table>

</body>
</html>
